<%--
 *  File:    ProductPopWindow.jsp	
 *  @Author: fekindai
 *  Date:    2008/12/17
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "All";
  String strTableName = "v_zylareaallsummary";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>products</title>
<PageFlow:CheckPageFlow pageName="p_zylareaallsummary"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<%
  Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
  if(searchresults == null) searchresults = new Vector();
   String num = (String)request.getParameter("num");
%>
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "AreaAllWindow.jsp?<%= OvalTools.randomURL() %>&num=<%=num%>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function getAreaInfo(elementid,id,name,code,parentid){	
	var checkedelement = document.getElementById(elementid);
	//if(checkedelement.checked){
		//checkedelement.checked = false;
	//}else {
	//alert("getAreaInfo");
		checkedelement.checked = true;
		document.cform.newareaname.value=name;
		document.cform.newareaid.value=id;
		document.cform.newareacode.value=code;
		document.cform.newparentareaid.value=parentid;
	//}
	
} 
function setAreaCode2OtherWindow()
{	
	var ids=document.cform.newareaid.value;
	var parentid=document.cform.newparentareaid.value;
	var names=document.cform.newareaname.value;
	var codes=document.cform.newareacode.value;
	if(ids==null||ids==""||names==null||names==""||codes==null||codes=="")
	return;
	window.opener.setNewAreaCode(ids,names,codes,parentid,<%=num%>);
	window.close();
}
</script>
</head> 

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_zylareaallsummary">
    <input type="hidden" name="actionname">
    
    <%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>
    
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
      </tr>
      <tr>
      	<td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
            <tr class="deepblue-left">
              <td width="4%" class="title_center">&nbsp;</td>
              <td class="title_center" width="24%"><a href="javascript:page_summary('orderby','areacode')"><%= label.getLabelName("L_AreaCode") %></a></td>
              <td class="title_center" width="24%"><a href="javascript:page_summary('orderby','areaname')"><%= label.getLabelName("L_AreaName") %></a></td>
             
             </tr> 
  		<%
            int i = 0;
            String strClassType = new String("");
            Integer nDefaultProdId = new Integer(-1);
            boolean bHasChecked = false;
            int nDefaultIndex=0;
          %>
            <logic:iterate id="onerow" collection="<%=searchresults %>" indexId="idx">
            <%
                HashMap onepattern = (HashMap)pageContext.getAttribute("onerow");
            	String strIsChecked = new String("");
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
           
            i++;

           %>     
            <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%= strClassType %>'" 
             onClick="javascript:getAreaInfo('areacode<%=i %>', '<custom:write property="areaid" name="onerow" />','<custom:write property="areaname" name="onerow" />','<custom:write property="areacode" name="onerow" />','<custom:write property="parentareaid" name="onerow" />')" class="<%= strClassType %>">
              <td>
             
              	<input type="radio" name="brmappuingid" id="areacode<%=i %>" class="normalradio" value="<custom:write property="areacode" name="onerow" />"
              		onclick="javascript:getAreaInfo('areacode<%=i %>', '<custom:write property="areaid" name="onerow" />','<custom:write property="areaname" name="onerow" />','<custom:write property="areacode" name="onerow" />','<custom:write property="parentareaid" name="onerow" />')"/>
			 
			  </td>
              
              <td>
                <custom:write property="areacode" name="onerow" />
              </td>
              <td>
                <custom:write property="areaname" name="onerow" />
              </td>
            </tr>
          
            </logic:iterate>


<%--  the new detail line  --%>

            <%@ include file="/inc/SummaryAction.inc" %>         
           </table>  
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
                <input type="hidden" name="newareaname" value="">
                <input type="hidden" name="newareaid" value="">
                <input type="hidden" name="newareacode" value="">
                <input type="hidden" name="newparentareaid" value="">
                <a onclick="javascript:setAreaCode2OtherWindow();"><custom:button type="1" label="L_Add" imgsrc="new.gif" border="0" style="width:60"/></a>
             
              </td>
            </tr>
          </table> 		
      	</td>
      </tr>
     </table>
</form>
</body>